<template>
	<scroll-view class="proview" :scroll-y="true">
		<up-loading-page :loading="true" loading-text="加载中..."></up-loading-page>
		<image :src="imgSrc" mode="widthFix" class="image"></image>
	</scroll-view>
</template>

<script>
	// import {
	// 	previewMonthly,
	// 	previewYearly
	// } from "@/api/proview.js"
	import Mine from '@/api/mine.js'
	import {
		baseUrl,
		baseImgUrl
	} from '@/config'
	export default {
		data() {
			return {
				planId: '',
				imgSrc: '',
				loading: false,
			}
		},
		onLoad(option) {
			this.planId = option.id
			if (option.type == 3) {
				this.getYearImg()
			} else {
				this.getMonthImg()
			}
		},
		methods: {
			// 获取月检任务
			getMonthImg() {
				this.loading = true
				Mine.previewMonthly(this.planId).then(res => {
					this.loading = false
					this.getData(res)
				})
			},
			// 获取年检任务
			getYearImg() {
				this.loading = true
				Mine.previewYearly(this.planId).then(res => {
					this.loading = false
					this.getData(res)
				})
			},
			getData(res) {
				if (res.code == 200) {
					this.imgSrc = res.msg
				}
			}
		}
	}
</script>

<style lang="less" scoped>
	.proview {
		width: 100%;
		height: 100%;

		// overflow: hidden;
		.image {
			width: 100%;
			height: 100%;
		}
	}
</style>